package cn.gdut.chengcai.enums;

import org.apache.commons.lang.StringUtils;

/**
 * 职称等级类型
 *
 * @author gates
 *
 */
public enum CourseLevelType {
	PRIMARY(1), // 初级
	INTERMEDIATE(2), // 中级
	SENIOR(3), // 高级
	MASTER(4), // 专家
	PRINCIPAL(5);// 首席

	private int value;

	private CourseLevelType(int value) {
		this.value = value;
	}

	public int getValue() {
		return value;
	}

	public String getString() {
		return getString(this.value);
	}

	public static String getString(Integer value) {
		String result = "未知";
		if (StringUtils.isEmpty(value.toString()) == true) {
			return result;
		}
		if (value == CourseLevelType.PRIMARY.getValue()) {
			result = "初级";
		} else if (value == CourseLevelType.INTERMEDIATE.getValue()) {
			result = "中级";
		} else if (value == CourseLevelType.SENIOR.getValue()) {
			result = "高级";
		} else if (value == CourseLevelType.MASTER.getValue()) {
			result = "专家";
		} else if (value == CourseLevelType.PRINCIPAL.getValue()) {
			result = "首席";
		}
		return result;
	}

	public static Integer getInteger(String value) {
		Integer result = null;
		if (value.equals("初级")) {
			result = CourseLevelType.PRIMARY.getValue();
		} else if (value.equals("中级")) {
			result = CourseLevelType.INTERMEDIATE.getValue();
		} else if (value.equals("高级")) {
			result = CourseLevelType.SENIOR.getValue();
		} else if (value.equals("专家")) {
			result = CourseLevelType.MASTER.getValue();
		} else if (value.equals("首席")) {
			result = CourseLevelType.PRINCIPAL.getValue();
		}
		return result;
	}
}